#include<iostream>
#include<iomanip>
#include<string.h>
#include<cmath>
#include<stdio.h>
using namespace std;
double f(double  x)
{
   if(x>=0&&x<2) return 2.5-x;
   else if(x>=2&&x<4)  return 2-1.5*(x-3)*(x-3);
   else if(x>=4&&x<6)  return x/2.0-1.5;
}
int main()
{
   double n;
   while(cin>>n)
    cout<<setiosflags(ios::fixed)<<setprecision(3)<<f(n)<<endl;
   // system("pause"); 
    return 0;
}
